package com.simple.common;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 加载静态资源文件
 *
 * @author wangyutong
 * @time 2019.10.16
 */
@Component
@Order(1)
public class ConstantsPropertity {


    public static String TOKEN_PREFIX;
    @Value("${auth.token.prefix}")
    public void setTokenPrefix(String tokenPrefix) {
        ConstantsPropertity.TOKEN_PREFIX = tokenPrefix;
    }

    public static String TOKEN_HEADER;
    @Value("${auth.token.header}")
    public void setTokenHeader(String tokenHeader) {
        ConstantsPropertity.TOKEN_HEADER = tokenHeader;
    }

    public static String TOKEN_SUBJECT;
    @Value("${auth.token.subject}")
    public void setTokenSubject(String tokenSubject) {
        ConstantsPropertity.TOKEN_SUBJECT = tokenSubject;
    }

    public static String TOKEN_SECRET;
    @Value("${auth.token.secret}")
    public void setTokenSecret(String tokenSecret) {
        ConstantsPropertity.TOKEN_SECRET = tokenSecret;
    }

    public static Long TOKEN_EXPIRETIME;
    @Value("${auth.token.expireTime}")
    public void setTokenExpiretime(Long tokenExpiretime) {
        ConstantsPropertity.TOKEN_EXPIRETIME = tokenExpiretime;
    }

    public static String COOKIE_DOMAIN;
    @Value("${auth.cookie.domain}")
    public void setCookieDomain(String cookieDomain) {
        ConstantsPropertity.COOKIE_DOMAIN = cookieDomain;
    }

    public static String COOKIE_PATH;
    @Value("${auth.cookie.path}")
    public void setCookiePath(String cookiePath) {
        ConstantsPropertity.COOKIE_PATH = cookiePath;
    }

    public static Integer COOKIE_MAXAGE;
    @Value("${auth.cookie.maxAge}")
    public void setCookieMaxAge(Integer cookieMaxAge) {
        ConstantsPropertity.COOKIE_MAXAGE = cookieMaxAge;
    }

    public static boolean COOKIE_HTTPONLY;
    @Value("${auth.cookie.httpOnly}")
    public void setCookieHttpOnly(boolean cookieHttpOnly) {
        ConstantsPropertity.COOKIE_HTTPONLY = cookieHttpOnly;
    }

    public static Integer SERVER_PORT;
    @Value("${server.port}")
    public void ServerPort(Integer serverPort) {
        ConstantsPropertity.SERVER_PORT = serverPort;
    }

    public static boolean FLAG;
    @Value("${test.flag}")
    public void setTest(boolean flag) {
        ConstantsPropertity.FLAG = flag;
    }
}
